<!--master-->
<table>
	<caption>
		<label for="recordType"><g:message code="b2b.salesOrder.recordType" default="Record Type" /></label>:
		${salesOrderInstance?.recordType?.encodeAsHTML()}
		<g:hiddenField name="recordType.id" value="${salesOrderInstance?.recordType?.id}" />
	</caption>
    <tbody>
        <tr class="prop">
        	<!-- dealer -->
            <td class="name">
                <label for="dealer"><g:message code="b2b.salesOrder.dealer" default="Dealer" /></label>
            </td>
            <td class="value ${hasErrors(bean: salesOrderInstance, field: 'dealer', 'errors')}">
                <g:textField name="dealerInput" value="${salesOrderInstance?.dealer?.encodeAsHTML()}"/>
                <g:hiddenField name="dealer.id" value="${salesOrderInstance?.dealer?.id}" />
            </td>
            <!-- department -->
            <td class="name">
                <label for="department"><g:message code="b2b.salesOrder.department" default="Department" /></label>
            </td>
            <td class="value ${hasErrors(bean: salesOrderInstance, field: 'department', 'errors')}">
                <span id="department">
                    ${include(controller : 'salesOrderAjax', action : 'getDealerDepartment', params : [dealerSerialNumber : salesOrderInstance?.dealer?.serialNumber] )}
                </span>
            </td>
            <!-- order date -->
            <td class="name">
                <label for="orderDate"><g:message code="b2b.salesOrder.orderDate" default="Order Date" /></label>
            </td>
            <td class="value ${hasErrors(bean: salesOrderInstance, field: 'orderDate', 'errors')}">
            	<g:set var="orderDate" value="${salesOrderInstance.orderDate?salesOrderInstance.orderDate:new Date() }"></g:set>
                ${formatDate(format:'yyyy-MM-dd', date : orderDate) }
                <g:hiddenField name="orderDate_year" value="${formatDate(format:'yyyy', date : orderDate) }" />
                <g:hiddenField name="orderDate_month" value="${formatDate(format:'MM', date : orderDate) }" />
                <g:hiddenField name="orderDate_day" value="${formatDate(format:'dd', date : orderDate) }" />
            </td>
		</tr>  
		
		<tr class="prop">
            <!-- industry -->
            <td class="name">
            	<label for="industry"><g:message code="b2b.salesOrder.industry" default="Industry" /></label>
            </td>
            <td class="value ${hasErrors(bean: salesOrderInstance, field: 'industry', 'errors')}">
                <g:textField name="industryInput" value="${salesOrderInstance?.industry?.encodeAsHTML()}" />
                <g:hiddenField name="industry.id" value="${salesOrderInstance?.industry?.id}"  />
			</td>
        	<!-- project -->
            <td class="name">
				<label for="project"><g:message code="b2b.salesOrder.project" default="Project" /></label>
			</td>
            <td class="value ${hasErrors(bean: salesOrderInstance, field: 'project', 'errors')}">
				<g:textField name="project" value="${salesOrderInstance?.project }"/>
			</td>
        	<!-- account serial number -->
            <td class="name">
				<label for="accountSerialNumber"><g:message code="b2b.salesOrder.accountSerialNumber" default="Account Order Number" /></label>
			</td>
            <td class="value ${hasErrors(bean: salesOrderInstance, field: 'accountSerialNumber', 'errors')}">
				<g:textField name="accountSerialNumber" value="${salesOrderInstance?.accountSerialNumber }"/>
			</td>
		</tr>
		<tr class="prop">
			<!-- sales man -->
            <td class="name">
                <label for="salesMan"><g:message code="b2b.salesOrder.salesMan" default="Sales Man" /></label>
            </td>
            <td class="value ${hasErrors(bean: salesOrderInstance, field: 'salesMan', 'errors')}">
                <span id="salesMan">${salesOrderInstance?.salesMan?.encodeAsHTML()}</span>
                <g:hiddenField name="salesMan.id" value="${salesOrderInstance?.salesMan?.id}" />
            </td>
        	<td class="name">&nbsp;</td>
        	<td class="value">&nbsp;</td>
        	<td class="name">&nbsp;</td>
        	<td class="value">&nbsp;</td>
		</tr>

        <tr class="prop">
            <td class="name">
                <label for="address1"><g:message code="b2b.salesOrder.address1" default="Address(1)" /></label>
            </td>
            <td class="value ${hasErrors(bean: salesOrderInstance, field: 'address1', 'errors')}" colspan="5">
                <g:textArea name="address1" maxlength="72" value="${salesOrderInstance?.address1}" rows="1" readOnly="readOnly" />
            </td>
        </tr> 

        <tr class="prop">
            <td class="name">
                <label for="address2"><g:message code="b2b.salesOrder.address2" default="Address(2)" /></label>
            </td>
            <td class="value ${hasErrors(bean: salesOrderInstance, field: 'address2', 'errors')}" colspan="5">
                <g:textArea name="address2" maxlength="72" value="${salesOrderInstance?.address2}" rows="1" readOnly="readOnly" />
            </td>
        </tr> 
		
        <tr class="prop">
        	<!-- description -->
            <td class="name">
                <label for="description"><g:message code="b2b.salesOrder.description" default="Desc" /></label>
            </td>
            <td class="value ${hasErrors(bean: salesOrderInstance, field: 'description', 'errors')}" colspan="5">
                <g:textArea name="description" cols="40" rows="5" value="${salesOrderInstance?.description}" />
            </td>
        </tr>		
		   
	</tbody>
</table>
<!--end master-->
<g:render template="/b2b/salesOrder/edit_dealer_220_detail" />
<g:render template="/b2b/salesOrder/script" />
<g:render template="/b2b/salesOrder/script_220" />
